package blocksim.util;

import com.sleepycat.bind.tuple.TupleBinding;
import com.sleepycat.bind.tuple.TupleInput;
import com.sleepycat.bind.tuple.TupleOutput;

@SuppressWarnings("rawtypes")
public class BlockInfoBinding extends TupleBinding {

	public BlockInfo entryToObject(TupleInput input) {
		BlockInfo block = new BlockInfo();
		block.setBlockSize(input.readLong());
		block.setBlockFrequency(input.readInt());
		return block;
	}
	
	public void objectToEntry(Object object, TupleOutput output) {
		BlockInfo block = (BlockInfo) object;
		output.writeLong(block.getBlockSize());
		output.writeInt(block.getBlockFrequency());
	}
}
